#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QMessageBox* box = new QMessageBox(this);
    box->setText("this is a box");
    box->setStandardButtons(QMessageBox::Save | QMessageBox::Cancel |QMessageBox::Ok);
    QPushButton* button = new QPushButton("hello",box);
    box->addButton(button,QMessageBox::AcceptRole);
    box->setIcon(QMessageBox::Warning);
    int res = box->exec();
    if(res == QMessageBox::Save)
        qDebug() << "Save";
    else if(res == QMessageBox::Cancel)
        qDebug() << "Cancel";
    else if(res == QMessageBox::Ok)
        qDebug() << "Ok";

    delete box;
}
